import { useSelector } from 'react-redux'
import { RootState } from '../../types/store'

// import { Channel } from '../../types/channel'

// 手动的编写仓库中的数据类型
// interface State {
//   counter: number
//   channel: Channel[]
// }

export default function CompB () {
  const myCount = useSelector((state: RootState) => state.counter)
  const channels = useSelector((state: RootState) => state.channel)

  return (
    <div>
      CompB
      <p>store value is {myCount}</p>
      <ul>
        {channels.map(item => {
          return <li key={item.id}>{item.name}</li>
        })}
      </ul>
    </div>
  )
}
